package com.huatai.bi.controller;

import com.huatai.bi.query.PreviewDataQuery;
import com.huatai.bi.service.DataProcessService;
import com.huatai.bi.service.impl.DirectoryServiceImpl;
import com.huatai.bi.vo.Direcr.PreviewDatVO;
import com.huatai.common.api.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @BelongsProject: itc-airport-cloud
 * @BelongsPackage: com.huatai.bi.controller
 * @Author: hecaiy
 * @CreateTime: 2024-07-02  10:21
 * @Description: TODO 数据预览
 * @Version: 1.0
 */
@RestController
@RequestMapping("/preview")
@Api(tags = "数据预览")
public class PreviewDataController {

    @Autowired
    private DirectoryServiceImpl directoryService;
    @Autowired
    private DataProcessService dataProcessService;

    @ApiOperation("原始数据集数据预览")
    @PostMapping("/previewSourceData")
    public R<PreviewDatVO> previewSourceData(@RequestBody PreviewDataQuery query){
        return R.data(directoryService.dataPreviewByDtId(query.getDtId(),query.getPageIndex(),query.getPageSize()));
    }

    @ApiOperation("加工数据集数据预览")
    @PostMapping("/previewProcessData")
    public R<PreviewDatVO> previewProcessData(@RequestBody PreviewDataQuery query){
        return R.data(dataProcessService.previewProcessData(query.getDtId(),query.getPageIndex(),query.getPageSize()));
    }

}
